import Suggestion from '../components/suggestion';
import * as CompanyAction from 'actions/company';
import * as ReactRedux from 'react-redux';

const mapStateToProps = (state) => {
  return {
    options: state.searchCompanyList.list.map(company => {
      return {
        value: company.id,
        text: company.name
      };
    }),
    placeholder: '输入公司名称来查找公司'
  };
};

const mapDispatchToProps = (dispatch) => {
  return {
    onSuggest: (value) => {
      return dispatch(CompanyAction.search(value));
    }
  };
};

export default ReactRedux.connect(mapStateToProps, mapDispatchToProps)(Suggestion);
